﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity.Infrastructure;
using DLM.Domain.Model;

namespace DLM.Data.EF.CodeFirst.Mapping
{
    public class FriendMap:EntityTypeConfiguration<Friend>
    {
        public FriendMap()
        {
            this.HasKey(t => t.FriendID);
            this.ToTable("Friend");
            this.Property(t => t.FriendID).HasColumnName("FriendID");
            this.Property(t => t.UserID).HasColumnName("UserID");
            this.Property(t => t.MyFriendID).HasColumnName("MyFriendID");
            this.Property(t => t.CreateDate).HasColumnName("CreateDate");
            this.Property(t => t.IsConfirmed).HasColumnName("IsConfirmed");
            this.HasOptional(t => t.User).WithMany(t => t.Friend).HasForeignKey(d => d.UserID);
        }
    }
}
